#include <Python.h>
#include "regex_html.h"

/*$Id: htmltag.c 5 2012-10-26 04:17:18Z hymm91@gmail.com $*/
static PyObject * htmltag(PyObject *self, PyObject *args);

static PyObject *htmltag(PyObject *self, PyObject *args)
{
	char *src;
	int len;
	if (!PyArg_ParseTuple(args, "s|i", &src, &len)) {
			return NULL;
	}
	
	REGEX_HTML html;
	char retbuf[40240];
	int retlen = 40240;
	init_html_arg(&html, src, len, retbuf, retlen);
	start_parse(&html);
	retlen = html.result_len;
	return Py_BuildValue("s", retbuf);
}

static PyMethodDef addMethods[] = 
{
	{"htmltag", htmltag, METH_VARARGS, "html no tag"},
	{NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC inithtmltag()
{
	Py_InitModule("htmltag", addMethods);
}

/*$Id: htmltag.c 5 2012-10-26 04:17:18Z hymm91@gmail.com $*/
